package com.selenium.webdriver;

import java.util.List;

import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;

public class SelectAFlightPage {
	
	@FindBy(name = "outFlight")
	List <WebElement> outFlightRadioButtons;
	
	@FindBy(name = "inFlight")
	List <WebElement> inFlightRadioButtons;
	
	@FindBy(name ="reserveFlights")
	WebElement reserveFlightButton;
	
	public void selectOutAndInFlights(String[] outAndInFlights)
	{
		switch (outAndInFlights[0].charAt(outAndInFlights[0].length()-1)) 
		{
	    case '0':
	    	outFlightRadioButtons.get(0).click();
	        break;
	    case '1':
	    	outFlightRadioButtons.get(1).click();
	        break;
	    case '2':
	    	outFlightRadioButtons.get(2).click();
	        break;
	    case '3':
	    	outFlightRadioButtons.get(3).click();
	        break;
		}
		
		switch (outAndInFlights[1].charAt(outAndInFlights[1].length()-1)) 
		{
	    case '0':
	    	inFlightRadioButtons.get(0).click();
	        break;
	    case '1':
	    	inFlightRadioButtons.get(1).click();
	        break;
	    case '2':
	    	inFlightRadioButtons.get(2).click();
	        break;
	    case '3':
	    	inFlightRadioButtons.get(3).click();
	        break;
		}
	}
	public void clickReserveFlightButton ()
	{
		reserveFlightButton.click();
	}

}
